/*
 * @Author: your name
 * @Date: 2020-09-18 16:39:33
 * @LastEditTime: 2020-10-19 18:34:53
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \supplyweb\src\apis\user.js
 */
import request from '@/utils/request'


/**---------------- */

/**
 * 获取登录企业的用户信息
 * @param {*} id 
 * @returns 
 */
export function getUserById (id) {
    return request({
        url: '/basic-api/system/user/' + id,
        method: 'get'
    })
}



/**---------------- */




//注册
export function Register (data) {
    return request({
        url: '/wenge/microservice-supply-consumer-web/Account/CreateKey',
        method: 'POST',
        data
    })
}
export function Login (data) {
    return request({
        url: '/wenge/microservice-supply-consumer-web/user/login',
        method: 'GET',
        data
    })
}

// 获取用户信息
export function GetUserInfo (data) {
    return request({
        url: '/wenge/microservice-supply-consumer-web/auth/getLoginUserInfo',
        method: 'GET',
        data
    })
}

// 退出登录
export function GetLogout (data) {
    return request({
        url: '/wenge/microservice-supply-consumer-web/auth/logout',
        method: 'post',
        data
    })
}


// 获取用户token 
export function getAccessToken (code) {
    return request({
        url: '/wenge/microservice-supply-consumer-web/auth/getAccessToken',
        method: 'get',
        // data : { code }
        headers: { code }
    })

}


const removeTokenUrl = process.env.NODE_ENV == 'development' ? '/oauth/remove/token' : GolbUrl.uaaUri + '/oauth/remove/token';

// 退出登录 
export function LogOutAccessToken (access_token) {
    return request({
        url: removeTokenUrl,
        method: 'get',
        params: {
            access_token,
            redirect_uri: "http://test.ilh.szlhq.gov.cn/aupply-chains-14-16203"
        }
    })
}


